﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_buy_Ordering : System.Web.UI.Page
{
    public Tuan.Model.Products productInfo = new Tuan.Model.Products();
    public Tuan.Model.UserInfo userInfo = new Tuan.Model.UserInfo();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["pid"] != null)
        {
            productInfo = (new Tuan.BLL.Products()).GetModel(int.Parse(Request["pid"]));
            if (productInfo == null)
                Response.Write("<script type='text/javascript'>window.close();window.location='/pages/usercenter/myorderlist.aspx';</script>");
            userInfo = (new Tuan.BLL.UserInfo()).GetModel(User.Identity.Name);
            if (productInfo.DiscountPrice>0)
            {
                //Response.Write("<script type='text/javascript'>alert('未下架');</script>");
            }
            else
            {
                productInfo.DiscountPrice =Convert.ToInt32(productInfo.OldPrice);
               // Response.Write("<script type='text/javascript'>alert('此商品没有折扣价格');window.location='/pages/usercenter/myorderlist.aspx';</script>");
            }
            //<script type="text/javascript">alert("商品已下架");window.close();</script>
        }
        else
        {
            Response.Write("<script type='text/javascript'>window.close();window.location='/pages/usercenter/myorderlist.aspx';</script>");
        }
    }
}
